// import {useSelector, useDispatch} from 'react-redux'
// import React from 'react'
// import {actionsSetName} from './store/actions'
// import {SET_NAME} from './store/actions'

// export default function App() {
//   const name = useSelector(state => state.name);
//   const dispatch = useDispatch();

//   const setName = () => {
//     dispatch({type: SET_NAME})
//   }

//   const syncSetName = () => {
//     dispatch(actionsSetName())
//   }

//   return (
//     <div>
//       {
//         name
//       }
//       <button onClick={() => setName()}>改名字</button>
//       <button onClick={() => syncSetName()}>2秒后改名字</button>
//     </div>
//   )
// }


import React from 'react'
import {useDispatch, useSelector} from 'react-redux'
export default function App() {
  const dispatch = useDispatch();
  const user = useSelector(state => state.user)
  return (
    <div>
      {
        user.username
      }
      <button onClick={() => dispatch({type: 'ASYNC_LOGIN'})}>按钮</button>
    </div>
  )
}

